#ifndef ZDATA_IO_H_
#define ZDATA_IO_H_

#include "../Common/GlobalDefines.h"
#include <tinyxml2.h>

GLOBAL_NAMESPACE_BEGIN

class DataManager;

class DataIO
{
public:
    static bool saveDataToXML(const char* xmlFile, DataManager* dataManager);

private:
    static tinyxml2::XMLElement* parseImagesToXML(tinyxml2::XMLDocument* doc, DataManager* dataManager);
    static DataManager* parseImagesFromXML(tinyxml2::XMLElement* elem, DataManager* dataManager);

    static int getType(const char* type);

    const static char* Types[];
    const static char* Attributes[];

    enum Type {
        XML_DATA_IO_Image = 0,
        XML_DATA_IO_ImageOne,
        XML_DATA_IO_2DPoint
    };

    enum Attribute {
        XML_DATA_IO_ImageId = 0,
        XML_DATA_IO_ImageName,
        XML_DATA_IO_ImageSrc,
        XML_DATA_IO_ImageType,
    };
};

GLOBAL_NAMESPACE_END

#endif//ZDATA_IO_H_